package producersConsumersTests.bypassersCount;

import producersConsumersTests.utils.RunnableWithId;

public class ClockVectorTask extends RunnableWithId {
	private long entries[], exits[];
	private int removerId;

	public ClockVectorTask(long id, int insertersNum, int removersNum) {
		super(id);
		entries = new long[insertersNum];
		exits = new long[removersNum];
	}

	public void updateEntry(int id) {
		for (int i = 0; i < entries.length; i++)
			entries[i] = Schedule.get().getEntry(i, (int) id);
	}

	public void updateExit(int id) {
		for (int i = 0; i < exits.length; i++)
			exits[i] = Schedule.get().getExit(i, id);
	}

	@Override
	public void run() {
	}

	public long[] entry() {
		return entries;
	}

	public long[] exit() {
		return exits;
	}

	public void setRemoverId(int removerId) {
		this.removerId = removerId;
	}

	public int getRemoverId() {
		return removerId;
	}

	public void setExit(long[] exitVectorClock) {
		for (int i = 0; i < exitVectorClock.length; i++)
			this.exits[i] = exitVectorClock[i];
	}
}
